Computer Graphics Programming in OpenGL with Java (2e)
Written by Mike James   

Author:  V. Scott Gordon
Publisher: Mercury
Date: September 2018
Pages: 406
ISBN: 978-1683922193
Print: 1683922190
Kindle:B07HNF4YSN
Audience: Java developers interested in 3D graphics
Rating: 5
Reviewer: Mike James
Java and graphics aren't a natural pairing - are they?

So you want to learn graphics. If you simply want to be a run of the mill game developer then learn to use one of the game engines - Unity for example. If you want to really know how graphics works then you need to learn one of the basic graphics systems - DirectX for Microsoft and OpenGL if you want to be platform-independent. If you want to be truly up-to-date then you might consider OpenGL's successor Vulkan, but it is supposed to be backward compatible, so why not learn OpenGL?

OK, but suppose you want to learn OpenGL using a high-level language? Java is not a natural for graphics because it is generally believed to be slow, but the JOGL Java wrapper for OpenGL works well enough and you shouldn't have problems with speed unless you are trying to do something really difficult. JOGL provides Java methods for all of the standard OpenGL C functions and they have the same name, so if you want to switch languages what you have learned generalizes. As well as JOGL the book makes use of OpenGL 4 shader language, which is slightly different from earlier versions.

Banner

Before we get to the details of the book it is worth stating that learning OpenGL is hard. It has ways of doing things that are not natural to most programmers. It takes time to get used to how to do things and to think about what your programs are making happen in the GPU.

Chapter 1 gets you started and Chapter 2 introduces a "hello world" program plus a break down of the graphic pipeline with its various shaders. Already at this point you should be impressed by the simplicity of the explanations. You are unlikely to get their full meaning the first time around but if you keep going it will all make sense. By the end of the chapter you have encountered most of the basic ideas and implemented a simple 2D object complete with animation.

Chapter 3 takes a time out to look at the math behind some aspects of 3D graphics - transformation matrices, vectors, dot and cross products and how to use all of this to implement a perspective projection. Chapter 4 returns to OpenGL and starts to explain the relationships between buffers, attributes and how they go together to create a 3D cube. Chapter 5 opens the difficult topic of texture mapping and Chapter 6 puts it all together with a 3D sphere and a torus.

 

Chapter 7 is where we start to move away from the mechanics of OpenGL and consider what we need from the pipeline to render realistic 3D graphics. The first topic we need to look at is lighting and how this works in 3D - Gourand and Phong shading are implemented. Chapter 8 is about the consequence of lighting i.e. shadows. Chapter 9 explains why we have to deal with backgrounds differently. Chapter 10 adds bump, normal and height mapping to improve the look of surfaces.

All of the work so far has use the vertex and fragment shader. Chapter 11 introduces parametric surfaces - using Bezier curves and Chapter 12 show how to use the tessellation shader to implement them. Chapter 13 moves on the the geometry shader. This brings the logical progression of topics to a close and we are left with Chapter 14 - a collection of special effects, fog, 3d textures, and noise. 

Conclusion

This is an easy introduction to OpenGL, well about as easy as a complex topic can get. The ideas are introduced in plain language and there are diagrams to help. The programs also help make the point of what exactly is being proposed - be prepared to read them in detail and you'll also find the code on the CD along with object models, figures and more.

You had better be fairly proficient in Java as you don't get any help in this area - and this is reasonable. If you know Java however this is a very good introduction to OpenGL and pipeline based graphics in general.

Highly recommended.

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


SQL Server 2022 Revealed

Author: Bob Ward
Publisher: Apress
Pages: 506
ISBN: 978-1484288931
Print:1484288939
Kindle: B0BLB4VJL9
Audience: DBAs & SQL devs
Rating: 5
Reviewer: Ian Stirk

This book aims to explain the new features in SQL Server 2022, how does it fare?



Embedded Vision: An Introduction (Mercury Learning)

Author: S. R. Vijayalakshmi and S. Muruganand
Publisher: Mercury Learning
Date: October 2019
Pages: 580
ISBN: 978-1683924579
Print: 1683924576
Kindle: B07YN6JC19
Audience: Developers interested in vision-enabled devices
Rating: 3
Reviewer: Harry Fairhead
The power of small machines is now well able to ta [ ... ]


More Reviews

Last Updated ( Sunday, 15 September 2019 )