Asynchronous read-back of pixel data using a Frame Buffer Object and two Pixel Buffer Objects

Author Kevin | 21.01.2011 | Category OpenGL

It was my intention to write a full article on this new sample, but who am I kidding – I barely have enough time to write this simple little blog post. So, instead of just sitting on the sample and deluding myself that I will someday have enough free-time to write something substantial concerning it – I will just toss it out the door with a brief announcement of, “Come and get it!”

Recently, I was struggling with an OpenGL feature that required me to research faster ways of reading pixel data back to the CPU from the GPU where I could perform some post processing on it. Typically, you should try very hard to keep your post processing on the GPU instead trying to read it back across the bus, but in this case I wanted to fetch the pixel data back so I could load it into a WPF app and I had no choice. It must come back and as fast as possible.

After much research, I settled on a solution that does an off-screen rendering to a FBO (frame buffer object) and then uses two alternating PBOs (pixel buffer objects) to perform an asynchronous read-back to system memory via DMA transfers. The beauty of this approach is that it disables the blocking behavior which is typically associated with calling glReadPixels, and this is always the prime culprit when it comes to bad read-back performance for pixel data that is being shuttled back across the bus. If you’re researching something similar, I hope this research sample proves useful.

The sample targets the regular desktop version of OpenGL and was coded and tested in Visual Studio 2005 and 2008 on both Windows Xp and Windows 7.

Introduction to OpenGL ES 2.0

Author Kevin | 02.11.2010 | Category OpenGL ES 2.0

Ever since I started developing for the iPhone and iPad I’ve had to re-learn OpenGL in its new mobile form as OpenGL ES 2.0. With that said, I still like being able to do my basic research on my Windows 7 laptop instead of hacking around inside XCode, which I’m still getting used to.

PowerVR Logo

Therefore, I decided to create some really simple, stand-alone OpenGL ES 2.0 samples that can run on Windows through PowerVR’s OpenGL ES 2.0 emulator.

Yes, I know that the emulator is part of a SDK that has a ton of samples, but I like small, self-contained samples that stand on their own and do not rely on a massive common samples library that hides most of the detail. And, yes, I also know that all this abstraction is meant to help me, but somehow it makes things seem even more mysterious when certain aspects of OpenGL ES are tucked away out of sight. Anyway, I just like tiny, bare-bone samples that get straight to the point.

If that’s you, read on.

Lua Tutorial #1 – The Setup

Author Kevin | 17.10.2010 | Category Lua Tutorials

I’m guessing by now that my regular visitors have grown tired of watching my new blog change WordPress themes from day-to-day and occasionally go berserk as I fiddle with all the blog settings and break the PHP code. With that said, I’ve decided to set things right by writing a series of tutorials on the Lua scripting which is loosely based on the course that I teach at the Guildhall at SMU.

Lua Logo
Lua is a rather popular scripting language for game design. If you don’t believe me just check out this list of games that use Lua. Clearly, anyone serious about game programming and especially learning scripting for level design, which is where Lua shines brightest, should take a moment out of their busy schedule and get too know Lua.

Ok, enough with the sales pitch.. let’s just jump in and gets this party started! goes blog!

Author Kevin | 25.09.2010 | Category News

Well, if things around here look different… that’s because they are. I’ve finally decided to get off my lazy duff and upgrade my old site into a blog. This not only gives me a great excuse to use cool new techno words like blog, blog rolls, blogosphere and flux capacitor, in everyday conversation, but it allows me to post new code samples in a cool new interactive format where people can complain… um… I mean interact with each other about the code being posted.

Now, while the site undergoes this incredible metamorphosis into something even cooler, all the code from the old site can still be accessed under the Code tab of the navigation bar.