1st Edition

Developing Graphics Frameworks with Java and OpenGL

By Lee Stemkoski, James Cona Copyright 2022
    308 Pages 135 Color & 19 B/W Illustrations
    by CRC Press

    308 Pages 135 Color & 19 B/W Illustrations
    by CRC Press

    308 Pages 135 Color & 19 B/W Illustrations
    by CRC Press

    Developing Graphics Frameworks with Java and OpenGL shows you how to create software for rendering complete three-dimensional (3D) scenes. The book explains 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 application programming interface (API) for graphics processing unit (GPU) programming, with the accessibility and versatility of the Java programming language.

    Topics in this book include generating geometric shapes, transforming objects with matrices, applying image-based textures to surfaces, and lighting a scene. Advanced sections explain how to implement procedurally generated textures, postprocessing effects, and shadow mapping. In addition to the sophisticated graphics framework discussed throughout the book, you will gain a foundational knowledge that will allow you to adapt and extend that framework, leading to even more spectacular graphical results.

    Author bios

    Lee Stemkoski is a professor of mathematics and computer science. He earned his Ph.D. in mathematics from Dartmouth College in 2006 and has been teaching at the college level since. His specialties are computer graphics, video game development, and virtual and augmented reality programming.

    James Cona is an up-and-coming software engineer who studied computer science at Adelphi University. Some of his specific interests include music, video game programming, 3D graphics, artificial intelligence, and clear and efficient software development in general.

    About the Authors

    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.4 Summary and Next Steps

     

    2. Introduction to LWJGL and OpenGL

    2.1 Creating Windows with LWJGL

    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 LWJGL 

    2.5.2 Incorporating with Graphics Programs

    2.6 Summary and Next Steps   

     

    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  

     

    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  

    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   

     

    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 Billboarding  

    5.7.2 Heads-Up Displays and Orthogonal Cameras  

    5.8 Rendering Scenes to Textures  

    5.9 Post-Processing  

    5.10 Summary and Next Steps

     

    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

    Biography

    Lee Stemkoski is a professor of mathematics and computer science. He earned his Ph.D. in mathematics from Dartmouth College in 2006 and has been teaching at the college level since. His specialties are computer graphics, video game development, and virtual and augmented reality programming.

    James Cona is an up and coming software engineer who studied computer science at Adelphi University. Some of his specific interests include music, video game programming, 3D graphics, artificial intelligence, and clear and efficient software development in general.