29 August 2013

Book: OpenGL Development Cookbook

OpenGL Development Cookbook
Recently, thanks to a contact with Packt Publishing, I got a chance to take a look at the new OpenGL book. It is called “ OpenGL Development Cookbook” and contains lots of interesting ideas (40 items!) regarding graphics programming. Let us dig into book's pages to see its real value.
First thing: the book is a cookbook. This means that we can find there many recipes ready for use. What is more important, those recipes work out of the box so one can quickly implement and play with them. 
OpenGL Development Cookbook
www.packtpub.com/opengl-development-cookbook
Second thing: the author describes Modern OpenGL (3.3 and above) so we can be sure the knowledge and used techniques are up to date. Another relevant thing is that the author - Muhammad Mobeen Movania - has a PhD degree in Advance Computer Graphics and Visualization. He is quite proficient at the graphics programming and he definitely knows how to create amazing things in the field. 
Third thing: a reader should be already familiar with OpenGL (and C++). The progression of the topics is sometimes quite fast. Knowledge how to render a quad and setup a vertex shader is for sure needed. 
The list of covered items is quite impressive:
  • From basic project setup to rendering a net using geometry shaders and making dynamic subdivisions. 
  • Various camera models and object picking. Essential for any application. 
  • Offscreen rendering: effects for postprocessing (like glow and blur) and dynamic cube mapping.. 
  • Basic Phong light model and then items describing PCF filtering and variance shadow mapping. 
  • Loading meshes from a disk. Several file formats are used and described. 
  • Global Illumination: GPU Ray Tracing, SSAO and Order Independent Transparency techniques. 
  • Volume rendering using various techniques. 
  • Physics done on the GPU: particles, skinning (even dual quaternions are involved) and simple cloth simulation. 
  • And even more… 
As you see, the register covers very important subjects that are fundamental to modern graphics programming. Most of them need to be embedded in any game engine sooner or later. In the beginning I was skeptical of the likelihood of creating that many topics and packing them into only 300 page book. However, it appears that the author managed to contradict my initial thoughts quite well.

What I like 

The structure of the book makes it pretty easy to follow. In the beginning, it is good to read the introduction and familiarize with the application framework. After that, a reader can read in whatever order he/she likes. Each of the items is written in a similar way. We have the following sections: Getting ready, How to do it, How it works, There’s more and See also. I find this arrangement perfect. Topics are of course done by a single person, so there is no need to switch between writing styles. 
Vast majority of items are very well done and explained. I liked chapter about Order Independent Transparency in particular. You have there very good explanation, pictures, code (with additional comments) and a comparison of techniques at the end.
Another great item relates to Volume rendering (3D Textures, ray casting, splatting). Before reading the chapter I thought that such topic is quite hard to implement. Now, it looks simpler and clearer. There is a detailed discussion about final quality of the output. More the slices (or texture samples) the better the result, but performance drops. 
I will not run through all chapters here, but in general each topic can be a great start to perform experiments on your own. At the end of each item you have additional resources to check. For instance when describing dynamic cube mapping we get a hint how to use layered rendering and geometry shaders to make this technique faster. 
Technology chosen is, in my opinion, very suitable. We have Visual C++ 2010, freeGLUT, Glm and SOIL.Those additional libraries are small and very simple to understand (not to mention their popularity). There is no additional need to learn some complicated framework/engine. 

What I dislike 

The level of topics is sometimes strange. We have a nice and easy item that describes basic lighting, or item about simple particle systems. Next to it we have advanced elements like OOIT using dual depth peeling or even more like Ray Tracing. I would prefer to have items that are more or less at the same level. Or at least change the “distance” between extremes. 
Some more description would be nice. I know that it is hard to compress all that knowledge in only 300 pages. But for some topics the author could make a bit more effort. For instance when dealing with geometry shaders and subdivision of a quad just a little diagram/image could explain more. This could make the book more complete. 
There are also some “code” problems. For instance, several times we can see “inverting image” code that wastes a bit of space in the book. It could be simplified by using SOIL library in a bit better way. Another thing is that you have to create your own projects files when you want to run it on different platforms. 

Final thoughts 

4 stars out of 5. 
OpenGL Development Cookbook is a very good book. I cannot give 5/5 mark, because there are some flaws and things that could be done, in my opinion, a bit better. Still, this book fills a niche in the area. We have very advanced books like "Gpu Pro " , and books for beginners like “OpenGL Superbible ”. It is great to see a book that is something between those two extremes. 
To sum up: The book is definitely worth reading for any developer who has already managed to render a triangle in OpenGL and wants to go further :)
submit to reddit Vote on Hacker News
Subscribe to our mailing list:
Content By Bartlomiej Filipek, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
To provide you service this website uses cookies. By using it, you agree to this. More info.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.