Archive for the 'Programming' Category

SIGGRAPH OpenGL presentation downloads

The OpenGL hompage reports that the OpenGL BOF (Birds of a Feather) presentations from this year’s SIGGRAPH are available for download (as Powerpoint slideshows).

Highlights include:

  • OpenGL 3 directions (Much leaner with a compatibility layer)
  • OpenGL New object model (Consistency… finally!)
  • OpenGL Upcoming features (Geometry shader, texture as table, conditional rendering)
  • OpenGL on Vista (After much fear and debate, I guess this is happening)

These presentations include information that people have been holding out for (the ARB have been very quiet for the last couple of years). However, due to the nature of the presentations, they are still fairly limited on details.

OpenGL 2.1 specification released

A news item on the OpenGL homepage announces that the OpenGL 2.1 specification has been released. (I’ve just downloaded it and will post my thoughts after I’ve had a good chance to go over it).

The news post also mentions that:

The OpenGL ARB is also developing an OpenGL 2.1 SDK complete with reference documentation, sample code, tutorials, tools and utilities for release in 2006.

Here are links to the Khronos/ARB press release and the specification download page.

OpenGL ARB and Khronos to merge

There have been a number of interesting news stories on the OpenGL homepage. I think with SIGGRAPH 2006 approaching, everything is coming to a head. The most interesting news is that Khronos Group and the OpenGL ARB are merging. This seems like a fairly natural progression and it will bring related technologies (such as OpenVG, EGL, and COLLADA) under the same banner as OpenGL.

The other interesting bit of news is the first issue of Pipeline, the OpenGL ARB newsletter. The ARB has been fairly quiet for the last… year or so… (their last public meeting notes are from December 2004). It’s good that they are making an effort to inform the wider development community about their… developments; The newsletter point to a GameDev article with a general overview of OpenGL 2.1. This first issue also mentions that it is most likely the last issue (due to the aforementioned merger).

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’

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:

glewInit();

/* These extensions must be supported */
assert(glewGetExtension("GL_ARB_vertex_shader"));
assert(glewGetExtension("GL_ARB_fragment_shader"));
assert(glewGetExtension("GL_ARB_texture_rectangle"));
assert(glewGetExtension("GL_EXT_framebuffer_object"));
assert(glewGetExtension("GL_ARB_draw_buffers"));

/* 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!

The technology behind Shadow of the Colossus

This article covers a lot of technology including: HDR effects, level-of-detail, stencil-buffer shadows, motion blur, collision detection, inverse kinematics, and fur rendering. A very, very good read.

It’s rare to see a detailed technical article like this from such a high profile game developer on the web. I strongly recommend that all the games/graphics programmers reading this check it out.

Update: It’s interesting to note that the main character is modelled as a sphere for collision detection.

Installing the J2ME Wireless Toolkit under Ubuntu

I wanted to check out the current work on Antiquities and had to go through a few hoops to get the J2ME Wireless Toolkit (J2ME WTK) working on my home machine (Ubuntu, Hoary). I figured that I’d post a (very) brief run-down to save everyone else some time.

Ubuntu is a debian-based distribution and Java support is hampered due to the restrictive Java license. There is some support for older versions of Java (1.1), but not for the more recent version we need in order to use the J2ME WTK.

The most recent version of the J2ME WTK available for Linux is 2.2. You will need to have the Java2 Standard Edition (J2SE) SDK installed before you can install the J2ME WTK. The most recent version of J2SE available for Linux is 5.0, but it is incompatible with the J2ME WTK 2.2. Rather, you need to install 1.4.2.

I found the easiest thing to do is to install the J2SE SDK in a non-system directory (such as your home directory). When installing J2ME WTK, you can input this path for the J2SE SDK. I also used a non-system directory for the J2ME WTK installation.

After it is up and running, you can get Antiquities out of Subversion and place it in the “apps” subdirectory of wherever you chose to install the J2ME WTK. If you’d like to check Antiquities out elsewhere, just create a symbolic link within the “apps” subdirectory.

Links to download pages:

Just a few closing notes. There are some instructions on the Ubuntu wiki detailing how to create a Debian package from the SUN J2SE binary, but these instructions are only for the 5.0 version (which is incompatible anyway). The future looks bright though, the next version of Ubuntu (Breezy) will have open source Java 1.4 packages.

GOMM revisited

I was working on plans for the game project at ViSLAB and dug up the old “Get Off My Mountain!” code. It didn’t work… so I made it work. That said, a lot of code is still pretty bad. Some of it is tied to clock speed: the thermometer never goes up on my machine because it’s too fast. Other bits are quite messy: why no enum or #defines for menu state and game state? (ints? ints!?!)

Anyhow, the important thing is that it compiles and runs. I even put a video on the wiki to prove it! (Jim: I hope it isn’t too big!) No sound unfortunately; Anyone want to try capturing sound? Check it out of CVS and have a hack around :)

Source code for J2ME game

Digimet has released under the GPL the source code for two of their J2ME games. It might be worth looking into for Antiquities.

Making videos of OpenGL programs

I saw Jim’s XG page and Jason’s plant animation page and thought that you guys might be interested in some GL video stuff that I’ve been working on (around half-way down the linked page). It makes it *much* easier to make movies for publications (or the wiki page!).