Developing Graphics Frameworks with Python and OpenGL shows you how to create software for rendering complete three-dimensional scenes. The authors explain the foundational theoretical concepts as well as the practical programming techniques that will enable you to create your own animated and interactive computer-generated worlds.
You will learn how to combine the power of OpenGL, the most widely adopted cross-platform API for GPU programming, with the accessibility and versatility of the Python programming language. Topics you will explore include generating geometric shapes, transforming objects with matrices, applying image-based textures to surfaces, and lighting your scene. Advanced sections explain how to implement procedurally generated textures, postprocessing effects, and shadow mapping. In addition to the sophisticated graphics framework you will develop throughout this book, with the foundational knowledge you will gain, you will be able to adapt and extend the framework to achieve even more spectacular graphical results.
Author(s): Lee Stemkoski, Michael Pascale
Publisher: CRC Press
Year: 2021
Language: English
Pages: 344
City: Boca Raton
Cover
Half Title
Title Page
Copyright Page
Table of Contents
Authors
CHAPTER 1 INTRODUCTION TO COMPUTER GRAPHICS
1.1 CORE CONCEPTS AND VOCABULARY
1.2 THE GRAPHICS PIPELINE
1.2.1 Application Stage
1.2.2 Geometry Processing
1.2.3 Rasterization
1.2.4 Pixel Processing
1.3 SETTING UP A DEVELOPMENT ENVIRONMENT
1.3.1 Installing Python
1.3.2 Python Packages
1.3.3 Sublime Text
1.4 SUMMARY AND NEXT STEPS
CHAPTER 2 INTRODUCTION TO PYGAME AND OPENGL
2.1 CREATING WINDOWS WITH PYGAME
2.2 DRAWING A POINT
2.2.1 OpenGL Shading Language
2.2.2 Compiling GPU Programs
2.2.3 Rendering in the ApplicationĀ
2.3 DRAWING SHAPES
2.3.1 Using Vertex Buffers
2.3.2 An Attribute Class
2.3.3 Hexagons, Triangles, and Squares
2.3.4 Passing Data between Shaders
2.4 WORKING WITH UNIFORM DATA
2.4.1 Introduction to Uniforms
2.4.2 A Uniform Class
2.4.3 Applications and Animations
2.5 ADDING INTERACTIVITY
2.5.1 Keyboard Input with Pygame
2.5.2 Incorporating with Graphics Programs
2.6 SUMMARY AND NEXT STEPS
CHAPTER 3 MATRIX ALGEBRA AND TRANSFORMATIONS
3.1 INTRODUCTION TO VECTORS AND MATRICES
3.1.1 Vector Definitions and Operations
3.1.2 Linear Transformations and Matrices
3.1.3 Vectors and Matrices in Higher Dimensions
3.2 GEOMETRIC TRANSFORMATIONS
3.2.1 Scaling
3.2.2 Rotation
3.2.3 Translation
3.2.4 Projections
3.2.5 Local Transformations
3.3 A MATRIX CLASS
3.4 INCORPORATING WITH GRAPHICS PROGRAMS
3.5 SUMMARY AND NEXT STEPS
CHAPTER 4 A SCENE GRAPH FRAMEWORK
4.1 OVERVIEW OF CLASS STRUCTURE
4.2 3D OBJECTS
4.2.1 Scene and Group
4.2.2 Camera
4.2.3 Mesh
4.3 GEOMETRY OBJECTS
4.3.1 Rectangles
4.3.2 Boxes
4.3.3 Polygons
4.3.4 Parametric Surfaces and Planes
4.3.5 Spheres and Related Surfaces
4.3.6 Cylinders and Related Surfaces
4.4 MATERIAL OBJECTS
4.4.1 Base Class
4.4.2 Basic Materials
4.5 RENDERING SCENES WITH THE FRAMEWORK
4.6 CUSTOM GEOMETRY AND MATERIAL OBJECTS
4.7 EXTRA COMPONENTS
4.7.1 Axes and Grids
4.7.2 Movement Rig
4.8 SUMMARY AND NEXT STEPS
CHAPTER 5 TEXTURES
5.1 A TEXTURE CLASS
5.2 TEXTURE COORDINATES
5.2.1 Rectangles
5.2.2 Boxes
5.2.3 Polygons
5.2.4 Parametric Surfaces
5.3 USING TEXTURES IN SHADERS
5.4 RENDERING SCENES WITH TEXTURES
5.5 ANIMATED EFFECTS WITH CUSTOM SHADERS
5.6 PROCEDURALLY GENERATED TEXTURES
5.7 USING TEXT IN SCENES
5.7.1 Rendering Text Images
5.7.2 Billboarding
5.7.2.1 Look-At Matrix
5.7.2.2 Sprite Material
5.7.3 Heads-Up Displays and Orthogonal Cameras
5.8 RENDERING SCENES TO TEXTURES
5.9 POSTPROCESSING
5.10 SUMMARY AND NEXT STEPS
CHAPTER 6 LIGHT AND SHADOW
6.1 INTRODUCTION TO LIGHTING
6.2 LIGHT CLASSES
6.3 NORMAL VECTORS
6.3.1 Rectangles
6.3.2 Boxes
6.3.3 Polygons
6.3.4 Parametric Surfaces
6.4 USING LIGHTS IN SHADERS
6.4.1 Structs and Uniforms
6.4.2 Light-Based Materials
6.5 RENDERING SCENES WITH LIGHTS
6.6 EXTRA COMPONENTS
6.7 BUMP MAPPING
6.8 BLOOM AND GLOW EFFECTS
6.9 SHADOWS
6.9.1 Theoretical Background
6.9.2 Adding Shadows to the Framework
6.10 SUMMARY AND NEXT STEPS
INDEX