OpenGL ES 2.0 Books/Tutorials

Not sure if this is the right place for this, but I’m looking for a good tutorial style book on OpenGL ES 2.0. I picked up the OpenGL ES 2.0 Programming Guide, and although thorough, it’s too elemental to be useful without a strong background in OpenGL already.





To give you an example, I’ve been working at OpenGL for about a month now and I’m still stymied by basic questions like “How do I manipulate objects independently of each other?”, "How do I load multiple objects into OpenGL?"





When I look for books or tutorials that might cover this they’re always too old and cover the fixed function pipeline. They talk about pushmatrix and popmatrix and other functions that no longer apply.


Oddly enough, you can find a ton of “Hello Triangle” tutorials and quite a few “Light Bloom” tutorials, but all the stuff in between seems a bit lacking.





Anyway, your suggestions would be most welcome.Legion2012-04-12 01:06:58

I suspect that you overestimate the possibilities of OpenGL: it is not a scene graph; thus, I’m actually not sure one can talk about “objects” in OpenGL. (An OpenGL draw call with the corresponding OpenGL state might come closest to the concept of an object.)





After some years of teaching OpenGL, I came to the conclusion that there is no such thing as a general “introduction to OpenGL ES 2.0” (and if there is, it’s not very useful). The problem is that the details of OpenGL ES 2.0 programming depend very much on the platform you are using: programming OpenGL ES 2.0 with the PowerVR SDK is different from programming OpenGL ES 2.0 in Objective-C in XCode, which is also different from programming OpenGL ES 2.0 shaders for iOS devices with Unity. And, of course, the Java wrapper of the Android SDK and the JavaScript wrapper known as WebGL are also different.





These are just 5 different ways of programming OpenGL ES 2.0. In my opinion an introduction should not try to cover more than one of these platforms.





So, which platform do you want to use? Once you know your platform, the choice of reasonable books/tutorials that cover that specific platform often boils down to exactly 1, which would make your choice a lot easier.





My question about moving objects independently came from a misunderstanding of how glDrawArrays works. I thought you passed all of the vertices used in a scene to the GPU, where they were cached. So if all the verts for all the meshes that make up a scene are in the VRAM and you apply a transformation, I thought that would apply to everything and not just the one mesh you wanted to move. I later found out that once you send the verts over they’re used and then gone, so you don’t have to worry. Except for VBOs, but that’s a bit different.





Anyway, I’m planning to do games on Android, but I couldn’t find any Android books about OpenGL ES 2.0, lots on 1.x though. So then I picked up the programming guide and have been using that plus whatever I find online with the PowerVR SDK. This has been a bit more comfortable as I don’t like Java or Eclipse and the PowerVR SDK lets me code in C++ in Visual Studio.





I’m obviously still in the early stages of learning, but it’s been pretty easy to see what the equivalent calls are in Android and the PowerVR SDK. Maybe that will change as I get into more advanced things. My (perhaps naive) perception is that it’s largely like switching between C and Pascal, mostly syntax.


I think you've already mastered the basics: once you realize that the core issue is shader programming in GLSL and the rest of OpenGL ES 2.0 is just syntax that you need to configure the pipeline, you are probably able to use a lot more resources.

I have to admit that I'm not aware of any books/tutorials about OpenGL ES 2.0 using the Android SDK. I saw this book: "Game and Graphics Programming for iOS and Android with OpenGL ES 2.0" by Romain Marucchi-Foino, ISBN: 978-119-97591; however, it uses the Android NDK (which also allows you to use C). Furthermore, it manages to handle two platforms (iOS and Android NDK) only by using the author's wrapper SDK. This is probably not such a bad idea because in the end you will probably not write an Android game with OpenGL ES 2.0 from scratch but you will use some kind of (basic) game engine, e.g. this mini game engine presented in that book.





Martin Kraus2012-04-16 23:09:04

I saw that book, but I don’t feel like learning another API, especially one that doesn’t have widespread use.





The other thing is, I like to avoid higher levels of abstraction if I can. This is just a matter of taste, but I find it frustrating that when you code to a high level API, it’s almost a given that it will be revised and I’ll have to learn a new way to do something I could already do. Sometimes I wonder if the development time is really shortened that much if you factor in the time learning the API. But there’s an appropriate context for everything.





The other thing is, having read about guys who made games for the NES, Atari and other early consoles, I was fascinated by the kinds of tricks and optimizations they came up with to squeeze every ounce of performance out of the hardware. I like to think that the Android/iOS platforms offer a similar opportunity for finding interesting ways to get good performance out of a mobile platform.

Legion wrote:
I saw that book, but I don't feel like learning another API, especially one that doesn't have widespread use.



The other thing is, I like to avoid higher levels of abstraction if I can. This is just a matter of taste, but I find it frustrating that when you code to a high level API, it's almost a given that it will be revised and I'll have to learn a new way to do something I could already do. Sometimes I wonder if the development time is really shortened that much if you factor in the time learning the API. But there's an appropriate context for everything.



I understand your doubts in this respect. And, of course, there are teams who have written great games from scratch (basically writing their own graphics and physics engine for their game). It might even be a promising way to set your game visually apart from the rest. However, it's a huge task for a single person.

Quote:

The other thing is, having read about guys who made games for the NES, Atari and other early consoles, I was fascinated by the kinds of tricks and optimizations they came up with to squeeze every ounce of performance out of the hardware. I like to think that the Android/iOS platforms offer a similar opportunity for finding interesting ways to get good performance out of a mobile platform.


I totally agree. I'm following a forum about shader programming in Unity and one insight that comes up all the time is that you can get a lot more graphics performance out of Android/iOS devices when you know what you are doing and write your own GLSL shaders instead of relying on Unity's built-in shaders.

Also, many of the techniques that are described in books like the GPU Gems series can be implemented in OpenGL ES 2.0; many of these techniques go beyond what games engines usually do.

Yeah, I have no delusions about making an A-list game on my own. But I’d like to make a couple simpler games on my own as a way to learn/experiment with different shading algorithms, OpenGL and Android.





Speaking of GPU Gems, I read an article about glow shaders in one of the books. It was written by a developer of Tron 2.0. He had some cool ideas, so I was going to try to incorporate some sort of glow/streaking effect into an asteroids clone as a first game project.