The OculusWorldDemo is little demo application which is shipped with the Oculus Rift SDK and demonstrates some features of the Rift. Recently, I (and some more people) came across a nasty exception while trying out the OculusWorldDemo in OpenGL mode.
When starting the demo, the demo breaks when trying to retrieve the OpenGL version of my system (Line 1901 in Render_GL_Device.cpp):
const char* version = (const char*)glGetString(GL_VERSION);
The function returns NULL and a few lines later an assert checks for the version and throws an exception. For retrieving a valid OpenGL version, one must create a valid OpenGL context before calling the glGetString function. In OculusWorldDemo this happens in Render_GL_Win32_Device.cpp at line 145 (HGLRC context = wglCreateContextAttribsARB(dc, 0, attribs);).
On my system (Windows 7, GeForce GTX 560 Ti), wglCreateContextAttribsARB fails to create a context and returns a NULL pointer. There are more than one reason for getting a NULL pointer here. Long story short, you can replace the function call by calling wglCreateContext instead. The function has only one argument (the handle to the device context) which is why we do not have to add some additional code.
Changing line 145 to HGLRC context = wglCreateContext(dc); does the trick. However, a proper solution would be to call wglCreateContext only if wglCreateContextAttribsARB fails to create a context.