Beta

Slashdot: News for Nerds

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Book Review: OpenGL 4.0 Shading Language Cookbook

Tommer (1913) writes | more than 2 years ago

0

Tommer writes "Hi ... the last time I wrote a book review, it was called a book report. Let me know if you have any suggestions, I would be happy to revise or add anything important that I have left out.

-- cut --

OpenGL 4.0 Shading Language Cookbook
"Over 60 highly focused, practical recipes to maximize your use of the OpenGL Shading Language"
by David Wolff

Packt Publishing
ISBN 978-1-849514-76-7
340 page PDF + example code ZIP

http://www.packtpub.com/opengl-4-0-shading-language-cookbook/book

The OpenGL Shading Language (GLSL) is evolving rapidly in tandem with
GPU hardware. Briefly, a shader is a compiled program which runs on
the massively-parallel GPU as part of the render process to determine
the colour of a pixel, the position of a vertex, or in GLSL 4.0,
pretty much anything. Older versions of OpenGL provided fixed shading,
lighting, and geometry-transformation functions. I was interested to
learn that these methods are deprecated in favour of ubiquitous GLSL.

OpenGL 4.0 Shading Language Cookbook (I'll call it "the Cookbook")
aims to get experienced OpenGL programmers up to speed using GLSL 4.0
to implement common rendering techniques, from those previously
provided by the fixed-function pipeline to more advanced variants
never before possible without CPU intervention.

To this end, the Cookbook is well-organized. The first chapter
"Getting Started with GLSL 4.0" covers the prerequisite libraries used
in the examples, how to pass data to a shader, and how to compile
C/C++ programs to use shaders. The second chapter "The Basics of GLSL
Shaders" covers simple "hello world" shaders. After that, it's
possible to skip forward into the remaining chapters to find the
recipe you're after:
        3: Lighting, Shading Effects, and Optimizations
        4: Using Textures
        5: Image Processing and Screen Space Techniques
        6: Using Geometry and Tessellation Shaders
        7: Shadows
        8: Using Noise in Shaders
        9: Animation and Particles

GPU hardware is evolving so quickly that my nVidia GeForce 9600M GT
doesn't even support OpenGL 4.0, so I couldn't test any of the sample
code. However, I had no trouble compiling the programs in the first
chapter with my old Ubuntu 10.10 system and a bit of fudging of OpenGL
4.0 constants. I was willing to presume that the code actually works
given the right GPU and produces output like the figures. All code
examples are available for download, and use qmake and the Qt OpenGL
bindings. Alternative libraries are mentioned where relevant, but I
found SDL conspicuous by its absence since it's more lightweight and
focused than the do-all Qt set.

The Cookbook organizes each recipe into 5 sections:
        Getting Ready — ingredients list
        How to do it ... — specific steps and example code
        How it works ... — explanation of the code
        There's more ... — variations on the example
        See also — links to related sections
This arrangement makes it very easy to flip to an example and find the
level of detail you need.

The code sections are mercifully brief, showing only the parts
relevant to the GLSL features being covered. The code download
includes all of these examples filled into the framework described in
the second chapter, so you can focus on reading the important stuff
but still see how it runs in context. The "See also" links aren't
hyperlinked in the PDF, but it's no big deal — most of the time this
references the previous or next section!

I'm interested in textures, so I gave chapter 4 a closer read. The
progression of examples was quite logical, covering basic texturing,
using textures for surface and lighting effects, and finally rendering
to textures. Techniques found in earlier chapters were referenced in
the "See also" sections, so I never felt lost. The requisite matrix
mathematics were covered enough to jog my memory, but not enough to
enlighten a neophyte, which is fine for a book of this level.

OpenGL 4.0 Shading Language Cookbook offers essential information for
OpenGL programmers entering the world of GLSL. Despite not being able
to run the examples, I feel like I'm ready to dive in to GLSL 4.0 once
I replace my antique GPU."

Link to Original Source

cancel ×

0 comments

Check for New Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account

Loading...