Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Image

OpenGL ES 2.0 Programming Guide 48

Martin Ecker writes "Mobile phones and other embedded devices are getting more and more powerful each year. The availability of dedicated hardware for 3D rendering is becoming increasingly ubiquitous, and the latest mobile phones come with 3D hardware acceleration that rivals the power of desktop graphics hardware. OpenGL ES 2.0 is the latest version of a cross-platform, low-level graphics API to utilize these new resources available in embedded devices. The OpenGL ES 2.0 Programming Guide published by Addison-Wesley Publishing aims to help the reader make use of the full power of OpenGL ES 2.0 to create interesting 3D applications." Keep reading for the rest of Martin's review.
OpenGL ES 2.0 Programming Guide
author Aaftab Munshi, Dan Ginsburg, Dave Shreiner
pages 417
publisher Addison-Wesley Publishing
rating 7/10
reviewer Martin Ecker
ISBN 0-321-50279-5
summary All you need to know to develop mobile phone 3D applications in OpenGL ES 2.0
The book is intended for an audience with experience in the C programming language and a solid foundation in computer graphics. No experience with the desktop version of OpenGL is necessary, however. The book starts out with a basic introduction of OpenGL ES and explains the differences between OpenGL ES 1.x and 2.0. The main difference is that 2.0 has completely dropped support for the fixed-function pipeline and is now completely shader-based. The book then immediately gets the reader's feet wet by discussing a first simple example program that renders a triangle on the screen. This is also where the downsides of dropping fixed-function support in OpenGL ES 2.0 become apparent. It takes almost 4 pages of code to render a simple triangle. The reason for this is that you need to write a vertex and fragment shader (albeit really simple ones) to transform vertices to device coordinates and to assign a color to each pixel of the triangle. Of course, in "real-life" applications this isn't much of a problem. The increased possibilities that programmable shaders have to offer outweigh the inconvenience of having a bit more setup code.

The book continues to discuss EGL, which is like WGL on Windows or GLX on Unix, i.e. the interface between OpenGL and the underlying operating system. The next few chapters give a basic introduction to the OpenGL Shading Language. As mentioned above, with OpenGL ES 2.0 using shaders is the only way to get something on the screen. So having a good grasp of the OpenGL Shading Language is essential. The discussion at this point is fairly dry and might overwhelm readers that haven't used a shading language before. Later chapters, however, delve more deeply into developing vertex and fragment shaders.

The subsequent chapters present how to specify vertices and primitives in OpenGL ES. OpenGL ES 2.0 only supports generic vertex attributes (since there is no fixed-function pipeline anymore) and vertex data can only be specified using vertex arrays or vertex buffer objects. Immediate mode as known from desktop OpenGL is not available.

Now that the reader is familiar with sending vertices and triangles to the 3D hardware, the book describes vertex and fragment shaders in more detail. There is also a pretty long chapter on texture mapping, going into the specifics of the API calls to define and upload textures to the hardware. There are numerous examples in these chapters that demonstrate how to do lighting, generate texture coordinates, perform vertex skinning, multitexturing. These are all essential examples because the fixed-function pipeline that used to do these things is not available in OpenGL ES 2.0.

The next two chapters deal with the backend of the pipeline discussing the various per-fragment operations following the fragment shader, such as stencil test, scissor test, depth test, and framebuffer blending. Also framebuffer and renderbuffer objects (FBOs) used to efficiently implement render-to-texture in OpenGL are discussed. FBOs are thankfully fully supported in OpenGL ES 2.0. It's nice to see a whole chapter on this topic since this particular feature took a long time to make its way into OpenGL.

Chapter 13 on advanced programming with OpenGL ES is probably the best part of the book for me. It is one of the longest chapters of the book and contains numerous examples of advanced shader techniques, such as per-pixel lighting, point sprite particle systems, 3D noise, procedural textures, and some others. The provided examples are a good starting point for experimentation.

The book concludes with a chapter on state queries, which are used to obtain various parameters about the OpenGL render state, and a chapter on the interesting topic of using OpenGL ES on handheld platforms, which briefly goes into OpenKODE. OpenKODE is a standard set of APIs that provides a unified interface to the system OS of handheld devices.

Overall, the OpenGL ES 2.0 Programming Guide is an excellent book if you want to start developing 3D graphics applications for today's embedded devices and bleeding-edge mobile phones. The book also does a good job of pointing out the differences and similarities with desktop OpenGL. So if you're already familiar with OpenGL the book can help you identify the limitations of OpenGL ES compared to its big cousin.

Martin has been involved in real-time graphics programming for more than 10 years and works as a professional game developer for High Moon Studios in sunny California.

You can purchase OpenGL ES 2.0 Programming Guide from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

*

This discussion has been archived. No new comments can be posted.

OpenGL ES 2.0 Programming Guide

Comments Filter:
  • Rivalling? (Score:5, Informative)

    by nick_davison ( 217681 ) on Monday October 06, 2008 @02:38PM (#25275893)

    the latest mobile phones come with 3D hardware acceleration that rivals the power of desktop graphics hardware

    If, by "desktop graphics hardware" we're comparing to the books, empty bottles and other assorted clutter, it exceeds them.

    If, however, we mean "desktop PC"... it only rivals it if we're talking about integrated chipsets from a decade ago.

    It's a cute dream. And Monkey Ball on my 480x320, ~50% of VGA resolution iPhone doesn't look half bad for a simplified version of a GameCube era title. But, even accepting there's better hardware than the iPhone for 3D... It's a LONG way from rivalling desktop graphics quality, even on a pixel for pixel comparrison where a 0.15MP phone is trying to compete with a 2.3MP 24 inch monitor that's pushing around 15x the number of pixels.

    It's kind of like saying I rival an olympic runner. It's true in so far as we both have legs and, if I limit my competing to being against small children in my own backyard, I can often win. In every other way that counts, it's just not happening though.

  • Re:3d displays? (Score:2, Informative)

    by ZeroFactorial ( 1025676 ) on Monday October 06, 2008 @02:59PM (#25276131)
    What you're referring to is known as Augmented Reality" [wikipedia.org] and a lot of smart people are working on it.
  • Re:Rivalling? (Score:3, Informative)

    by egomaniac ( 105476 ) on Monday October 06, 2008 @03:04PM (#25276187) Homepage

    Just learn from the OpenGL ES spec. It's not hard at all -- I was rendering real graphics in a few hours.

  • Re:Great! (Score:4, Informative)

    by Anonymous Coward on Monday October 06, 2008 @03:05PM (#25276191)

    The iPhone doesn't have an OpenGL ES 2.0 chip, it's a simple ES 1.1 part.

  • Re:Great! (Score:3, Informative)

    by atomicthumbs ( 824207 ) <atomicthumbs@gmai[ ]om ['l.c' in gap]> on Monday October 06, 2008 @03:10PM (#25276243) Homepage
    You can write it for the Pandora, too. That supports 2.0.
  • by eggnoglatte ( 1047660 ) on Monday October 06, 2008 @03:25PM (#25276415)

    OpenGL ES is a subset of OpenGL. For 2.0, they removed much of the fixed function pipeline and replaced it with GLSL (OpenGL's shading language). As such, I would expect it to be relatively straightforward to write ES code that runs on a modern OpenGL desktop (one that supports the latest GLSL). At most you'll need a few #ifdefs.

  • by Anonymous Coward on Monday October 06, 2008 @04:04PM (#25276895)

    http://vimeo.com/1716575
    Demo was developed for Texas Instruments OMAP3 platform, but should run on most OpenGL ES 2.0 platforms out there. It was released at Assembly 2008 Real Wild demo competition.

  • Re:Rivalling? (Score:5, Informative)

    by TheRaven64 ( 641858 ) on Monday October 06, 2008 @04:54PM (#25277415) Journal

    The OpenGL specs are written for hardware implementers and not for app programmers. Heck, I'm been implementing OpenGL for over 7 years and these specs still confuse me sometimes.

    Have you looked at the OpenGL ES 2.0 spec? I glanced over it a couple of days ago (a friend asked bought an OpenPandora system and asked me for advice about learning ES). It is much more readable than other versions of OpenGL, and includes some nice introductory text explaining the terminology that will be used later on. Someone capable of checking Wikipedia for general concepts when they find they don't understand what the spec is explaining (or who has already come across the general ideas in 3D computer graphics) should have no problems learning from it.

With your bare hands?!?

Working...