GPU programming notes

I’ve been writing an OpenGL application using OpenGL Shading Language (GLSL) shaders, framebuffer objects (FBOs), and draw buffers (DBs). I’ve come across a few gotchas along the way and made a few notes.

Follow the jump to find out more about how to get started, what to look out for, and a couple of the hacks I’ve used to make my shaders do what I want them to do. (Specifically, I describe how to clear colour attachments to different values and how to store tags in a floating point channel.)

Continue reading “GPU programming notes”

Pizza coupons

The price you pay for (crappy) pizzas in Perth depends primarily on whether or not you have coupons:

  • Price without coupons = “We might as well get decent pizza elsewhere (at one of those gourmet places).”
  • Price with coupons = “Well, at least it’s cheap…”

If you’re in the market for cheap pizza (ie. you’re a student or buying for an event), you probably only really want it if you have a coupon. Cheap pizza places here almost always accept competitor’s coupons, so you just need to obtain a coupon for one place.

A quick look around reveals that the Pizza Hut website offers coupons that you can download, print, and use. However, you need to register first. Luckily we have, the online website that lets users “find and share logins for websites that force you to register”.

Anyhow, this is the first account that comes up on Bugmenot:

Not quite as good as, but fairly amusing.

Code snippets: GLEW and assert

I’ve been using GLEW to handle my OpenGL extensions and I like using assert when developing test programs that require certain extensions.

The thing I like about assert is that it exits the program and prints out the error, file, and line number. That’s more of less what I would do using more lines of code (meaning more chance of stupid errors) or my own macro (why reinvent the wheel?). It also encourages the use of descriptive variable names (like “num_draw_buffers” instead of “n”) so that the error output is more meaningful.

Here’s a snippet from some recent code:


/* These extensions must be supported */

/* There must be at least 2 draw buffers */
    GLint num_draw_buffers;

    glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num_draw_buffers);

    assert(num_draw_buffers >= 2);

Finally, if you ever decide that you don’t need assertions (because your code is clearly perfect), #define NDEBUG disables them. Good stuff!

Pure Pwnage E3 Special

I’ve been fairly busy in “real life” and haven’t been posting much, but I thought that this deserves a mention. PurePwnage were at E3 and filmed an 8 minute special feature.

They even have their own in-browser flash video player (all the rage now). The image above is a screen-grab… I wonder how many people won’t bother reading this and will just try to click on it…

Ramifications of the PS3 controller

Since my last post, I’ve been thinking about the ramifications of the PS3 controller.

Although IGN asserts that the PS3 controller is nothing but a tilt sensor, it was described at the press conference as a 6 degrees of freedom (6DOF) controller. This means that it should detect tilt and motion in 3 axes (X, Y, and Z). I have a bit of experience with these types of sensors and I assume that the motion detection is accelerometer-based (since there are no external sensors for reference or calibration). That means it is okay for relative motion, but poor for absolute motion (the exact position in space tends to “slide” over time).

Technology and Gameplay

Now a bit about what I see as the key differences between the PS3 and Wii controllers. As I’ve described, I expect that the PS3 controller can detect orientation (very well) and changes in position (with small errors that accumulate over time). Based on what I know about the Wii controller, it looks to provide the same sort of orientation detection, better position detection (using position relative to external sensors), and exact pointer control (using the sensor at the front of the controller). So, the question is “how will these differences affect potential gameplay?”

It should be immediately obvious that there will be some games that cannot be played using the PS3 controller instead of the Wii controller. The most obvious is anything that that requires pointing to items on screen. It should be fairly intuitive to point at something directly using the Wii controller, but I can’t see how it would be possible on the PS3. The Wii controller could be used to easily navigate onscreen menus by pointing at them, but you won’t be able to do this on the PS3. This could make quite a difference in RTS or RPG games.

Anything that requires robust absolute positioning will also be problematic on the PS3. Accelerometers generally don’t provide “clean” data, and without external calibration you can’t know where the device is relative to the screen. This limits some types of gameplay. For example, a Wii Nintendogs game could position a toy exactly where the controller is relative to the screen, but a similar game on the PS3 will not be able to do so.

Effect on the Industry

Now onto what this all means to the games industry. Sony have offered a way for game developers to experiment with “tilt and motion” sensitive games without sacrificing potential sales by limiting themselves to a single platform (namely, the Wii). Even though the feature set isn’t as good as the Wii controller, third parties may be able to port their games by making a few changes. For example, they could replace the pointer-style input for menu selection with a more traditional scheme using the analog stick or direction pad, or they could remove requirements for absolute positioning.

It could all come down to developing for the lowest common denominator. In the current generation, many games were developed with the PS2 in mind because it was the least powerful and any PS2 game could easily be ported to the XBOX or Gamecube. Sony’s PS3 controller could represent a lowest common denominator for motion sensors, and this could have bad consequences. Here are a few possible negative ramifications on the major players:

  • Worse case for Nintendo: Third party Wii games tend not to utilise the Wii controller fully and they just look like the PS3 versions with worse graphics.
  • Worse case for Microsoft: Microsoft is now the only controller without basic motion sensors and people opt for the PS3 versions of games.
  • Worse case for Sony: Like the analog buttons on the Dual Shock 2, the motion sensor is not used much since games are developed with the Xbox360 controller in mind as well.

I suppose decribing these as the worst cases is a bit of a stretch. None of these scenarios is absolutely abysmal for any company: People may buy Wii for the first party games or because it is inexpensive, Microsoft could release a “Controller M” (for motion!), and Sony just end up paying for under-utilised features (it’s a decent gamble). I guess we’ll have to wait and see what happens. It could turn out to be a useless gimmick (like the PS2 analog buttons and the Dreamcast VMU) or it could help Sony maintain their position as market leader.

Sony scared?

I’m watching the Sony E3 conference using GameSpot’s Event Player and Sony have made a few changes to their PS3 controller that are clearly in response to the negative feedback to the “Boomerang” design and Nintendo’s innovative Wii controller.

The new controller looks exactly like the Dual Shock 2, but has a 6 DOF motion and orientation sensor (“with no external sensors” mentioned as an obvious jab at Nintendo). Shocking and not really that surprising at the same time. Personally, I liked the boomerang design (it looked comfortable).

E3 predictions

Just a few random predictions for E3.


  • Nintendo announces that a standard set of network-capable mini-games (like table tennis) will come bundled with the Wii to introduce people to the controller and Nintendo Wifi Connection.
  • Sega announces that a selection of popular Dreamcast games will be available on Xbox360 Live Arcade.

Unlikely (Or are they? Yes, yes they are):

  • Microsoft will release a smaller version of the Xbox360 for the Japan market re-launch. The “Xbox360 S” will use the new smaller (and cooler) CPU and also have integrated HD-DVD. Microsoft assures the Western world that these are only for Japan (but actually plans for the Xbox360 S to eventually become the standard model world-wide).
  • An intrepet journalist will reveal that all those Nintendothemed amateur videos on the net were part of a viral marketing campaign to foster interest in the classic games on Wii’s virtual console.

Ridiculously Unlikely:

  • The final version of the PS3 controller is revealed! It consists of a remote control type device with motion and position sensors, and a joystick that can be attached via a cable in a sort of nunchuku-style.. scratch that, I’m sure it will be more innovative… the two components will be connected wirelessly!
  • The XboxMove handheld is announced and I recieve a whopping great design royalty cheque in the mail… wait a second, this is Microsoft… I recieve a court order to cease and desist any mention of the XboxMove!
  • Nintendo announces that the Wii moniker is just a joke. 😛

Thoughts? Anyone else have predictions?

DS lite on June 1 in Australia

I saw this on a press release on Nintendo Australia‘s website.


Melbourne, Australia May 5th 2006 – Nintendo Australia is pleased to announce the new member of the Nintendo DS range, the upgraded Nintendo DS Lite, will be available in Australia on June 1st, at SRP$199.95.

Nintendo DS Lite, launching in Polar White, features brighter screens, is approximately two-thirds the size of the original Nintendo DS and about 20 percent lighter. It also features a larger stylus and repositioned button layout, all the while maintaining all of the original Nintendo DS features, as well as screen size.

I’m trying to convince myself of a reason to buy it… but I’m not sure that I can.

Update: Other information in the news story includes release dates for New SUPER MARIO BROS. (June 8th) and Dr Kawashima’s Brain Training: How Old Is Your Brain? (June 15th). There’s also a rather disjoint introduction to the Wii name.

ATI buys Bit Boys

Voodoo Extreme is reporting that ATI has announced that it is buying BitBoys for $44 million (US dollars I presume).

This announcement is made more interesting because Hybrid Graphics, which BitBoys have a very close relationship with, announced that it was being acquired by Nvidia earlier this year. Bit Boys even uses Hybrid Graphics software drivers (or at least they did at some point) and members of both have worked on technology together (notably the delay stream paper from SIGGRAPH a few years ago).